package com.qf.efserver.login.controller;


import com.qf.common.core.annotation.NoLoginCheck;
import com.qf.common.core.common.R;
import com.qf.efserver.login.service.SMSCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author hehecheng
 * Date 2024/10/28
 * 祝我们都能遇见真诚的人
 * 见字如面
 */
//登录验证码
@RestController
@RequestMapping("/SMSCode")
@Api(tags = "验证码api")
@Slf4j
public class SMSCodeController {

    @Autowired
    private SMSCodeService smsCodeService;

    /**
     * 通过手机号获取验证码
     *
     * @param phone 手机号
     * @return
     */
    @ApiOperation(value = "通过手机号获取验证码")
    @ApiParam(name = "phone", value = "手机号")
    @NoLoginCheck
    @GetMapping("/GetCode")
    public R<String> GetCode(String phone) {
        log.info("验证码参数:{}", phone);
        String code = smsCodeService.GetCode(phone);
        log.info("返回的验证码:{}", code);
        return R.ok(code);
    }
}
